package com.littleindian.radioskypipeviewer;

import java.nio.ByteBuffer;

public class CircularByteBuffer {
	private enum Direction {
		READ,
		WRITE
	}
	
	private ByteBuffer mbb;
	private byte[] mByteArray;
	private Direction mDir;
	
	public CircularByteBuffer(int size) {
		mByteArray = new byte[size];
		mbb = ByteBuffer.wrap(mByteArray);
	}
	
	public int put(byte b) {
		if(mbb.hasRemaining()) {
			mbb.put(b);
		}
		else {
			
		}
		return mbb.position();
	}
	
	private void setDirection(Direction dir) {
		if(mDir != dir) {
			
			mDir = dir;
		}
	}
}
